package com.yc.sole.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yc.sole.common.enums.CommonState;
import com.yc.sole.common.enums.UserType;
import com.yc.sole.framework.mybatis.entity.BaseEntity;
import jakarta.persistence.*;
import lombok.Data;

/**
 * 对象
 *
 * @author yizuomin
 * @date 2023-03-26
 **/
@Data
@Entity
@Table(name = "sys_user", indexes = {
        @Index(name = "idx_username", columnList = "username", unique = true),
        @Index(name = "idx_phone", columnList = "phoneNum", unique = true)})
@TableName(value = "sys_user")
public class User extends BaseEntity {

    /**
     * id
     */
    @TableId(type = IdType.AUTO)
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    /**
     * 用户名
     */
    @Column(columnDefinition = "VARCHAR(50) NOT NULL COMMENT '用户名'")
    private String username;
    /**
     * 密码
     */
    @Column(columnDefinition = "VARCHAR(255) NOT NULL COMMENT '密码'")
    private String password;
    /**
     * 手机号码
     */
    @Column(columnDefinition = "VARCHAR(11) NOT NULL COMMENT '手机号码'")
    private String phoneNum;
    /**
     * 邮箱
     */
    @Column(columnDefinition = "VARCHAR(50) COMMENT '邮箱'")
    private String email;
    /**
     * 状态
     */
    @Column(columnDefinition = "TINYINT(1) NOT NULL COMMENT '状态 0无效 1有效'")
    private CommonState state;
    /**
     * 用户类型
     */
    @Column(columnDefinition = "TINYINT(1) NOT NULL COMMENT '用户类型 0系统用户 1普通用户'")
    private UserType userType;
    /**
     * 最后登录时间
     */
    @Column(columnDefinition = "VARCHAR(20) COMMENT '最后登录时间'")
    private String lastLoginDate;
    /**
     * 部门id
     */
    @Column(columnDefinition = "BIGINT COMMENT '部门id'")
    private Long deptId;
}
